{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "def load_unit2index(file):\n",
    "    unit2index = dict()\n",
    "    with open(file, 'r') as fp:\n",
    "        for line in fp:\n",
    "            unit, index = line.strip().split('\\t')\n",
    "            unit2index[unit] = int(index)\n",
    "    index2unit = {value:key for key,value in unit2index.items()}\n",
    "    return unit2index,index2unit\n",
    "def load_text(file):\n",
    "    item2text = {}\n",
    "    with open(file, 'r') as fp:\n",
    "        fp.readline()\n",
    "        for line in fp:\n",
    "            item, text = line.strip().split('\\t', 1)\n",
    "            item2text[item] = text\n",
    "    return item2text\n",
    "item2index,index2item = load_unit2index(\"/home/ysh/project/KDA_LRD/data/Office_Products/Office.item2index\")\n",
    "user2index,index2user = load_unit2index(\"/home/ysh/project/KDA_LRD/data/Office_Products/Office.user2index\")\n",
    "item2text = load_text(\"/home/ysh/project/KDA_LRD/data/Office_Products/Office.text\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 2  1  2  1 27  7 11  1 30 10  2 13 41  8 75 88 93  1 36  1 67  5 31  1\n",
      "  4  1  8 68  1  3  8  5  1  2  1  1 17 48  2  2 15  1 62  1  2 15 45  1\n",
      " 11 41]\n",
      "[  2   1   2   3  36   3   7   1  13  19   2   7  16   1   4  62 100   1\n",
      "  54   1  83   4  34   1   3   1  22  74   3   3   6   1   2   4   1   2\n",
      "   9  68   2   1  41   5  49   1   1  15  33   3  16  21]\n"
     ]
    }
   ],
   "source": [
    "import pickle\n",
    "with open('LRD_gt_rank_office.pkl', 'rb') as f:\n",
    "    lrd_gt_rank = pickle.load(f)\n",
    "with open('KDA_gt_rank_office.pkl', 'rb') as f:\n",
    "    rcf_gt_rank = pickle.load(f)\n",
    "print(lrd_gt_rank[:50])\n",
    "print(rcf_gt_rank[:50])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'history_target': array([[  17,   27],\n",
       "        [  19,   27],\n",
       "        [  20,   27],\n",
       "        ...,\n",
       "        [   0, 2262],\n",
       "        [   0, 2262],\n",
       "        [   0, 2262]]),\n",
       " 'predict': array([[0.01768673, 0.19852313, 0.41770977, ..., 0.02447723, 0.02957251,\n",
       "         0.01795129],\n",
       "        [0.0105215 , 0.26585507, 0.5406845 , ..., 0.01635182, 0.01977694,\n",
       "         0.01088435],\n",
       "        [0.01048231, 0.24563357, 0.49776697, ..., 0.01760257, 0.02289389,\n",
       "         0.01129325],\n",
       "        ...,\n",
       "        [0.        , 0.        , 0.        , ..., 0.        , 0.        ,\n",
       "         0.        ],\n",
       "        [0.        , 0.        , 0.        , ..., 0.        , 0.        ,\n",
       "         0.        ],\n",
       "        [0.        , 0.        , 0.        , ..., 0.        , 0.        ,\n",
       "         0.        ]], dtype=float32)}"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "with open('LRD_result_office.pkl', 'rb') as f:\n",
    "    data = pickle.load(f)\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "history_target = data[\"history_target\"].reshape(-1,20, 2)\n",
    "predict = data[\"predict\"].reshape(-1,20, 13)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "162 A3N4VTNFPMTHEF\n",
      "Epson WorkForce 600 Wireless All-in-One Printer (Black) (C11CA18201) Office Electronics\n",
      "tensor([0.1007, 0.0952])\n",
      "[0, 12]\n",
      "162 A3N4VTNFPMTHEF\n",
      "Avery NoteTabs, 3 x 1.5 Inches, Neon Blue and Magenta, 16 per pack (16299) Removable Labels\n",
      "tensor([0.3134, 0.2354])\n",
      "[2, 1]\n",
      "162 A3N4VTNFPMTHEF\n",
      "Avery NoteTabs, 3 x 3.5 Inches, Pastel Blue, 20 per pack (16330) Removable Labels Avery\n",
      "tensor([0.3402, 0.2691])\n",
      "[2, 1]\n",
      "162 A3N4VTNFPMTHEF\n",
      "Sharpie 1758054 Pen-Grip Fine Point Pen, Colored Ink, 3-Pack Porous-Point Pens Sharpie\n",
      "tensor([0.0990, 0.0986])\n",
      "[5, 12]\n",
      "162 A3N4VTNFPMTHEF\n",
      "Canon PIXMA MX870 Wireless Office All-in-One Printer (4206B002) Office Electronics Canon\n",
      "tensor([0.1157, 0.1129])\n",
      "[12, 5]\n",
      "Smead Hanging Folder without Tab, Letter, 2-Inch Expansion, Assorted Colors, 25 per Box (64264) Hanging Folders & Interior Folders Smead\n",
      "LRD rank_result: 4\n",
      "RCF rank_result: 28\n",
      "------------------------------------------------------\n",
      "331 ALRCAGJOJ9583\n",
      "Avery Removable Window and Wall Signage, InkJet, 8.5 x 11-Inches, White, Pack of 10 (22800) All-Purpose Labels Avery\n",
      "tensor([0.1088, 0.0877])\n",
      "[4, 12]\n",
      "331 ALRCAGJOJ9583\n",
      "Avery Textured Print-To-The-Edge Arched Labels, Laser Printers, 3 x 2.25-Inches, White, Pack of 90 (22809) All-Purpose Labels Avery\n",
      "tensor([0.1042, 0.1028])\n",
      "[5, 12]\n",
      "331 ALRCAGJOJ9583\n",
      "Epson WorkForce WF-7510 Wireless All-in-One Wide-Format Color Inkjet Printer, Copier, Scanner, Fax (C11CA96201) Inkjet Printers Epson\n",
      "tensor([0.5239, 0.3929])\n",
      "[2, 1]\n",
      "331 ALRCAGJOJ9583\n",
      "Epson Stylus Photo R3000 Wireless Wide-Format Color Inkjet Printer (C11CA86201) Inkjet Printers Epson\n",
      "tensor([0.2452, 0.1757])\n",
      "[3, 2]\n",
      "Epson DURABrite T127520 Ultra 127 Extra High-capacity Inkjet Cartridge Color Multipack-Cyan/ Magenta/ Yellow Inkjet Printer Ink Epson\n",
      "LRD rank_result: 2\n",
      "RCF rank_result: 13\n",
      "------------------------------------------------------\n",
      "1497 A3SMD3T0QTN109\n",
      "Velcro Sticky-Back Hook and Loop Fastener Tape with Dispenser, 3/4-Inch by 5-Feet Roll, Black Mounting Tape Velcro\n",
      "tensor([0.1465, 0.0785])\n",
      "[1, 6]\n",
      "1497 A3SMD3T0QTN109\n",
      "Brother PT-80 P-touch Electronic Labeling System Label Makers Brother\n",
      "tensor([0.0956, 0.0952])\n",
      "[5, 8]\n",
      "1497 A3SMD3T0QTN109\n",
      "Blu-Tack Reusable Adhesive Adhesive Putty Bostik\n",
      "tensor([0.1400, 0.0955])\n",
      "[2, 1]\n",
      "1497 A3SMD3T0QTN109\n",
      "Weighmax 2822-75LB postal shipping scale, Battery and AC Adapter Included Postal Scales\n",
      "tensor([0.5633, 0.4217])\n",
      "[2, 1]\n",
      "1497 A3SMD3T0QTN109\n",
      "Paper Mate Profile Retractable Ballpoint Pens, Assorted Ink, 8 Pack (54549) Ballpoint Pens Paper Mate\n",
      "tensor([0.1396, 0.1286])\n",
      "[4, 3]\n",
      "S.P. Richards Company Package Sealing Tape, 3Core, 1-7/8 x 164 Feet, 6-Pack, Clear (SPR60041) Packing Tape Sparco\n",
      "LRD rank_result: 4\n",
      "RCF rank_result: 13\n",
      "------------------------------------------------------\n",
      "2509 A34IC48GLL4U3Y\n",
      "Epson Stylus NX420 Color Ink Jet All-in-One (C11CA80201) Printers Epson\n",
      "tensor([0.5165, 0.1792])\n",
      "[2, 1]\n",
      "2509 A34IC48GLL4U3Y\n",
      "GP Copy & Print Paper, 8.5 x 11 Inches Letter Size, 92 Bright White, 20 Lb, 5 Reams/Carton (2500 Sheets) (998068C) Copy & Multipurpose Paper Georgia-Pacific\n",
      "tensor([0.3081, 0.2621])\n",
      "[1, 2]\n",
      "2509 A34IC48GLL4U3Y\n",
      "Staedtler Mars Plastic Erasers,Pack of 4 (52650BK4) Cube Erasers Staedtler\n",
      "tensor([0.1230, 0.1227])\n",
      "[5, 12]\n",
      "2509 A34IC48GLL4U3Y\n",
      "Pilot Namiki IC100 Fountain Pen Ink Cartridge, Black, 12 Cartridges per Pack (69100) Fountain Pens Pilot\n",
      "tensor([0.1197, 0.1143])\n",
      "[12, 5]\n",
      "2509 A34IC48GLL4U3Y\n",
      "Epson DURABrite T125120 Ultra 125 Standard-capacity Inkjet Cartridge -Black Inkjet Printer Ink Epson\n",
      "tensor([0.2759, 0.1915])\n",
      "[2, 1]\n",
      "Epson Expression Home XP-410 Small-in-One All-in-One Wireless Inkjet Printer (C11CC87201) Inkjet Printers Epson\n",
      "LRD rank_result: 2\n",
      "RCF rank_result: 27\n",
      "------------------------------------------------------\n",
      "3048 A32EOHLFZYXJEP\n",
      "Avery Half-Fold Greeting Cards for Inkjet Printers, 5.5 inches x 8.5 inches, White, Matte, Pack of 20 (03265) Greeting Cards Avery\n",
      "tensor([0.1043, 0.1031])\n",
      "[5, 0]\n",
      "3048 A32EOHLFZYXJEP\n",
      "Avery Adhesive Name Badges, 2.33 x 3.375 inches, White, Pack of 160 (08395) Removable Labels Avery\n",
      "tensor([0.2976, 0.1539])\n",
      "[2, 1]\n",
      "3048 A32EOHLFZYXJEP\n",
      "Uni-ball Jetstream 101 Bold Point Rollerball Pens, Colored Ink, 3 Pens (1772523) Rollerball Pens Uni-ball\n",
      "tensor([0.5159, 0.2866])\n",
      "[2, 1]\n",
      "3048 A32EOHLFZYXJEP\n",
      "Stanley Bostitch EZ Squeeze 40 Flat Clinch Reduced Effort Stapler (B9040) Desktop Staplers BOSTITCH\n",
      "tensor([0.1750, 0.1288])\n",
      "[1, 2]\n",
      "3048 A32EOHLFZYXJEP\n",
      "AT&T 1739 Corded Digital Answering System, White Answering Devices AT&T\n",
      "tensor([0.1456, 0.1308])\n",
      "[3, 4]\n",
      "Paper Mate InkJoy 300 RT Retractable Medium Point Ballpoint Pens, Assorted Colors, 8 Pack (1781564) Rollerball Pens Paper Mate\n",
      "LRD rank_result: 1\n",
      "RCF rank_result: 11\n",
      "------------------------------------------------------\n",
      "3142 A342PAZ5NSQRM3\n",
      "Avery PocketTabs, 5.125 x 6 Inches, CD Size, Lime and Blue, 5 per pack (16362) Removable Labels Avery\n",
      "tensor([0.0965, 0.0872])\n",
      "[5, 12]\n",
      "3142 A342PAZ5NSQRM3\n",
      "Avery NoteTabs Round Edge, 2 x 1.5 Inches, Citrus, 20 per pack (16306) Removable Labels Avery\n",
      "tensor([0.1315, 0.1078])\n",
      "[4, 3]\n",
      "3142 A342PAZ5NSQRM3\n",
      "3M Permanent Adhesive File Folder Labels, 0.66 x 3.437 Inches, White, 1500 per Pack (3300-F) File Folder Labels\n",
      "tensor([0.4776, 0.4138])\n",
      "[1, 2]\n",
      "3142 A342PAZ5NSQRM3\n",
      "Avery Plastic Durable Write-On Dividers, 5.5 x 8.5 Inches, 5 Tabs, 1 Set (16180) Binder Index Dividers Avery\n",
      "tensor([0.2302, 0.1723])\n",
      "[3, 4]\n",
      "3142 A342PAZ5NSQRM3\n",
      "PaperPro EvoLX Desktop Metal Stapler (1433) Desktop Staplers Paper Pro\n",
      "tensor([0.4361, 0.4112])\n",
      "[1, 2]\n",
      "Swingline Commercial Desk Stapler, 20 Sheets, Black (44401) Desktop Staplers Swingline\n",
      "LRD rank_result: 2\n",
      "RCF rank_result: 17\n",
      "------------------------------------------------------\n",
      "3228 A1N10E26UAQ2TF\n",
      "HP Photosmart 8250 Printer (Q3470A#ABA) Inkjet Printers HP\n",
      "tensor([0.0844, 0.0837])\n",
      "[5, 8]\n",
      "3228 A1N10E26UAQ2TF\n",
      "Sharpie 75846 Fine Point Permanent Marker, Assorted Colors, 24-Pack Permanent Markers Sharpie\n",
      "tensor([0.2124, 0.1876])\n",
      "[4, 3]\n",
      "3228 A1N10E26UAQ2TF\n",
      "Avery Shipping Labels with TrueBlock Technology, Inkjet Printers, 5.5 x 8.5 Inches, White, Pack of 50 (8126) Shipping Labels Avery\n",
      "tensor([0.5735, 0.3944])\n",
      "[2, 1]\n",
      "3228 A1N10E26UAQ2TF\n",
      "USB Automatic Barcode Scanner Scanning Barcode Bar-code Reader with Hands Free Adjustable Stand (Black) Bar Code Scanners Brainydeal\n",
      "tensor([0.4600, 0.4291])\n",
      "[1, 2]\n",
      "3228 A1N10E26UAQ2TF\n",
      "Canon PIXMA MX340 Wireless Office All-in-One Printer (4204B019) Office Electronics\n",
      "tensor([0.1856, 0.1290])\n",
      "[1, 2]\n",
      "USPS Style 25 Lb x 0.1 OZ Digital Shipping Mailing Postal Scale with Batteries Postal Scales Weighmax\n",
      "LRD rank_result: 3\n",
      "RCF rank_result: 38\n",
      "------------------------------------------------------\n",
      "3936 A1E31MMY0SL9J7\n",
      "Allsop Monitor Stand Metal Art Jr. - Pewter (27021) Monitor Arms & Stands Allsop\n",
      "tensor([0.1107, 0.1071])\n",
      "[0, 12]\n",
      "3936 A1E31MMY0SL9J7\n",
      "Canon PIXMA MP495 Wireless Inkjet Photo All-In-One (4499B026) Printers\n",
      "tensor([0.1035, 0.0997])\n",
      "[4, 0]\n",
      "3936 A1E31MMY0SL9J7\n",
      "Canon PIXMA iP4820 Premium Inkjet Photo Printer (4496B002) Photo Printers\n",
      "tensor([0.1103, 0.1055])\n",
      "[5, 12]\n",
      "3936 A1E31MMY0SL9J7\n",
      "3M Precise Mouse Pad, Leatherette Gel Wrist Rest, Antimicrobial Protection, Battery Saving, 9.25 in x 8.75 in, Black Wrist Rests 3M\n",
      "tensor([0.1044, 0.1007])\n",
      "[0, 4]\n",
      "3936 A1E31MMY0SL9J7\n",
      "Fellowes Professional Series Compact Keyboard Tray (8018001) Keyboard Drawers & Platforms Fellowes\n",
      "tensor([0.1288, 0.1131])\n",
      "[4, 3]\n",
      "Five Star Zipper Binder Plus Multi Access File, 2-Inch Capacity, 13.75 x 12.12 x 3.5 Inches, Blue (72534) Round Ring Binders\n",
      "LRD rank_result: 1\n",
      "RCF rank_result: 19\n",
      "------------------------------------------------------\n",
      "4070 A2WM2TMKW9TSSG\n",
      "Scotch Adhesive Dot Roller, 0.31 x 49 Feet (6055) Mounting Tape Unknown\n",
      "tensor([0.1197, 0.1156])\n",
      "[4, 0]\n",
      "4070 A2WM2TMKW9TSSG\n",
      "Post-It Super Sticky Removable Color Coding Labels, 2 x 4 Inches, Assorted Neon, 150 per Pack (2700-W) Removable Labels\n",
      "tensor([0.2941, 0.1462])\n",
      "[4, 3]\n",
      "4070 A2WM2TMKW9TSSG\n",
      "Fellowes Foot Rocker with Microban Protection, Black (8024501) Footrests Fellowes\n",
      "tensor([0.1259, 0.0823])\n",
      "[4, 8]\n",
      "4070 A2WM2TMKW9TSSG\n",
      "Brother HL4570CDW Color Laser Printer with Wireless Networking and Duplex Laser Printers Brother\n",
      "tensor([0.0964, 0.0910])\n",
      "[5, 9]\n",
      "4070 A2WM2TMKW9TSSG\n",
      "Smead 2-Way Mini Organizer, 12 Pockets, Alpha and Monthly, 9-3/4W x 4-1/2 H, Flap with Elastic Closure, Blue with Manila Interior (70636) Expanding Wallets Smead\n",
      "tensor([0.2334, 0.1353])\n",
      "[4, 3]\n",
      "Five Star Hanging Locker Shelf, Red (72230) Modular Storage Systems\n",
      "LRD rank_result: 3\n",
      "RCF rank_result: 11\n",
      "------------------------------------------------------\n",
      "4227 A314KKDIJWCNMV\n",
      "Canon i860 Photo Printer Photo Printers\n",
      "tensor([0.1059, 0.1049])\n",
      "[5, 12]\n",
      "4227 A314KKDIJWCNMV\n",
      "Canon CanoScan 8400F Flatbed Scanner Flatbed & Photo Scanners\n",
      "tensor([0.1145, 0.1087])\n",
      "[12, 5]\n",
      "4227 A314KKDIJWCNMV\n",
      "Brother HL-3070CW Compact Digital Color Printer with Wireless Networking Laser Printers Brother\n",
      "tensor([0.0976, 0.0972])\n",
      "[5, 12]\n",
      "4227 A314KKDIJWCNMV\n",
      "Fiskars 12 Inch Titanium SureCut Paper Trimmer (01-005454) Rotary Trimmers Fiskars\n",
      "tensor([0.1479, 0.1319])\n",
      "[4, 3]\n",
      "4227 A314KKDIJWCNMV\n",
      "Stanley Bostitch EZ Squeeze 75 Flat Clinch Reduced Effort Stapler (B875) Heavy-Duty Staplers BOSTITCH\n",
      "tensor([0.1352, 0.1206])\n",
      "[4, 3]\n",
      "Mead Spiral Notebook, 3-Subject, 120-Count, Wide Ruled, Blue (72223) Wirebound Notebooks Mead\n",
      "LRD rank_result: 2\n",
      "RCF rank_result: 11\n",
      "------------------------------------------------------\n",
      "4641 A35DPBFIDM1DI5\n",
      "BIC Round Stic Ballpoint Pens, 1.0 mm, Black, Box of 12 (GMS11-Blk) Ballpoint Pens BIC\n",
      "tensor([0.0976, 0.0905])\n",
      "[5, 12]\n",
      "4641 A35DPBFIDM1DI5\n",
      "100 12x15.5 WHITE POLY MAILERS ENVELOPES BAGS 12 x 15.5 Envelope Mailers ValueMailers\n",
      "tensor([0.2405, 0.1722])\n",
      "[1, 2]\n",
      "4641 A35DPBFIDM1DI5\n",
      "Advantus Polypropylene Pencil Box with Lid, 8.5 x 5.5 x 2.5 Inches, Clear (AVT34104) School Supply Storage Boxes Advantus\n",
      "tensor([0.1359, 0.1034])\n",
      "[1, 2]\n",
      "4641 A35DPBFIDM1DI5\n",
      "25 #000 4x8 KRAFT BUBBLE MAILERS PADDED ENVELOPES 4 x 8 Envelope Mailers ValueMailers\n",
      "tensor([0.4073, 0.1723])\n",
      "[1, 2]\n",
      "Canon CL-241XL Office Products FINE Color Cartridge Ink Inkjet Printer Ink Canon\n",
      "LRD rank_result: 2\n",
      "RCF rank_result: 24\n",
      "------------------------------------------------------\n"
     ]
    }
   ],
   "source": [
    "import torch\n",
    "for uid in range(len(rcf_gt_rank)):  \n",
    "# uid = 18\n",
    "    history_target[uid][:,0], history_target[uid][0,1]\n",
    "    count = 0\n",
    "    history_item = []\n",
    "    history_item_id = []\n",
    "    for item in history_target[uid][:,0]:\n",
    "        if item == 0:\n",
    "            break\n",
    "        if count+1 > 5:\n",
    "            break\n",
    "        count += 1\n",
    "        history_item.append(item2text[index2item[item]])\n",
    "        history_item_id.append(index2item[item])\n",
    "    target_item = item2text[index2item[history_target[uid][0,1]]]\n",
    "    rank = torch.tensor(predict[uid][:count]).topk(2,axis=1)\n",
    "    if (rank.indices[:,0]==5).sum()>0 and lrd_gt_rank[uid] < 5 and 10 < rcf_gt_rank[uid]:\n",
    "    # if lrd_gt_rank[uid] < 5 and 10 < rcf_gt_rank[uid]:\n",
    "        for i in range(count):\n",
    "            # print(history_item_id[i],history_item[i])\n",
    "            print(uid,index2user[uid])\n",
    "            print(history_item[i])\n",
    "            print(rank.values[i])\n",
    "            print(rank.indices[i].tolist())\n",
    "        print(target_item)\n",
    "        print(\"LRD rank_result:\", lrd_gt_rank[uid])\n",
    "        print(\"RCF rank_result:\", rcf_gt_rank[uid])\n",
    "        print(\"------------------------------------------------------\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch\n",
    "topk = torch.tensor(data[\"predict\"]).topk(10, dim=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[0.1647, 0.9449, 0.8938, 0.5579, 0.9916, 0.1405, 0.0975, 0.1022, 0.1187,\n",
       "         0.1319, 0.1071, 0.0982, 0.1459],\n",
       "        [0.1643, 0.9449, 0.8784, 0.5424, 0.9821, 0.1375, 0.0965, 0.1018, 0.1115,\n",
       "         0.1303, 0.1070, 0.0933, 0.1443],\n",
       "        [0.1630, 0.9392, 0.8707, 0.5414, 0.9768, 0.1358, 0.0964, 0.1005, 0.1095,\n",
       "         0.1259, 0.1069, 0.0931, 0.1421],\n",
       "        [0.1622, 0.9387, 0.8644, 0.5215, 0.9758, 0.1353, 0.0961, 0.0997, 0.1082,\n",
       "         0.1259, 0.1068, 0.0928, 0.1383],\n",
       "        [0.1587, 0.9301, 0.8644, 0.5048, 0.9754, 0.1333, 0.0960, 0.0991, 0.1081,\n",
       "         0.1257, 0.1066, 0.0921, 0.1380],\n",
       "        [0.1585, 0.9301, 0.8594, 0.5004, 0.9754, 0.1327, 0.0959, 0.0986, 0.1081,\n",
       "         0.1243, 0.1042, 0.0916, 0.1379],\n",
       "        [0.1570, 0.9173, 0.8486, 0.4776, 0.9741, 0.1318, 0.0959, 0.0976, 0.1076,\n",
       "         0.1239, 0.1041, 0.0915, 0.1379],\n",
       "        [0.1568, 0.9131, 0.8486, 0.4591, 0.9733, 0.1316, 0.0957, 0.0976, 0.1076,\n",
       "         0.1236, 0.1039, 0.0913, 0.1368],\n",
       "        [0.1562, 0.9105, 0.8486, 0.4543, 0.9712, 0.1313, 0.0957, 0.0976, 0.1076,\n",
       "         0.1233, 0.1038, 0.0913, 0.1355],\n",
       "        [0.1560, 0.8997, 0.8486, 0.4289, 0.9652, 0.1312, 0.0954, 0.0975, 0.1074,\n",
       "         0.1230, 0.1038, 0.0912, 0.1349]])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "topk[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([650, 648, 649, 651, 646, 652, 653, 654, 647, 645])"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "topk[1][:,0]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def load_unit2index(file):\n",
    "    unit2index = dict()\n",
    "    with open(file, 'r') as fp:\n",
    "        for line in fp:\n",
    "            unit, index = line.strip().split('\\t')\n",
    "            unit2index[unit] = int(index)\n",
    "    index2unit = {value:key for key,value in unit2index.items()}\n",
    "    return unit2index,index2unit\n",
    "def load_text(file):\n",
    "    item2text = {}\n",
    "    with open(file, 'r') as fp:\n",
    "        fp.readline()\n",
    "        for line in fp:\n",
    "            item, text = line.strip().split('\\t', 1)\n",
    "            item2text[item] = text\n",
    "    return item2text\n",
    "item2index,index2item = load_unit2index(\"/home/ysh/project/KDA_LRD/data/Office/Office.item2index\")\n",
    "item2text = load_text(\"/home/ysh/project/KDA_LRD/data/Office/Office.text\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# read df_relation_1\n",
    "label = 8\n",
    "with open(f\"lable_{label}_item_pairs.txt\",\"w\") as outf:\n",
    "    for index, row in df[df[\"label\"]==label].iterrows():\n",
    "        # print(\"history_item_id:\",index2item[row[\"history_item_id\"]])\n",
    "        # print(\"target_item_id:\",index2item[row[\"target_item_id\"]])\n",
    "        # print(\"label:\",row[\"label\"])\n",
    "        outf.write(\"item1: \"+item2text[index2item[row[\"history_item_id\"]]]+\"\\t\"\"item2: \"+item2text[index2item[row[\"target_item_id\"]]]+\"\\n\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>history_item_id</th>\n",
       "      <th>target_item_id</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>17</td>\n",
       "      <td>27</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>19</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>20</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>21</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>22</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98095</th>\n",
       "      <td>0</td>\n",
       "      <td>2262</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98096</th>\n",
       "      <td>0</td>\n",
       "      <td>2262</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98097</th>\n",
       "      <td>0</td>\n",
       "      <td>2262</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98098</th>\n",
       "      <td>0</td>\n",
       "      <td>2262</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98099</th>\n",
       "      <td>0</td>\n",
       "      <td>2262</td>\n",
       "      <td>-1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>98100 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       history_item_id  target_item_id  label\n",
       "0                   17              27      1\n",
       "1                   19              27      2\n",
       "2                   20              27      2\n",
       "3                   21              27      2\n",
       "4                   22              27      2\n",
       "...                ...             ...    ...\n",
       "98095                0            2262     -1\n",
       "98096                0            2262     -1\n",
       "98097                0            2262     -1\n",
       "98098                0            2262     -1\n",
       "98099                0            2262     -1\n",
       "\n",
       "[98100 rows x 3 columns]"
      ]
     },
     "execution_count": 87,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# data[\"history\"] is a user history item matrix, [n_user,n_history_item], data[\"target\"] is a target item matrix, [n_target_item,], data[\"predict\"] is a predicted matrix contain the label of each history item to target item, [n_user,n_history_item]\n",
    "# obatain a dataframe of user history item and target item, each row is a triple (history_item_id, target_item_id, label)\n",
    "import pandas as pd\n",
    "history_item = data[\"history\"]\n",
    "target_item = data[\"target\"]\n",
    "predict = data[\"predict\"]\n",
    "history_item_id = []\n",
    "target_item_id = []\n",
    "label = []\n",
    "for i in range(len(history_item)):\n",
    "    for j in range(len(history_item[i])):\n",
    "        history_item_id.append(history_item[i][j])\n",
    "        target_item_id.append(target_item[i])\n",
    "        label.append(predict[i][j])\n",
    "df = pd.DataFrame({'history_item_id':history_item_id,'target_item_id':target_item_id,'label':label})\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>history_item_id</th>\n",
       "      <th>target_item_id</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>17</td>\n",
       "      <td>27</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>19</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>20</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>21</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>22</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98076</th>\n",
       "      <td>2312</td>\n",
       "      <td>2414</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98080</th>\n",
       "      <td>1308</td>\n",
       "      <td>2262</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98081</th>\n",
       "      <td>1435</td>\n",
       "      <td>2262</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98082</th>\n",
       "      <td>1176</td>\n",
       "      <td>2262</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98083</th>\n",
       "      <td>2117</td>\n",
       "      <td>2262</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>42979 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       history_item_id  target_item_id  label\n",
       "0                   17              27      1\n",
       "1                   19              27      2\n",
       "2                   20              27      2\n",
       "3                   21              27      2\n",
       "4                   22              27      2\n",
       "...                ...             ...    ...\n",
       "98076             2312            2414      1\n",
       "98080             1308            2262      6\n",
       "98081             1435            2262      2\n",
       "98082             1176            2262      6\n",
       "98083             2117            2262      0\n",
       "\n",
       "[42979 rows x 3 columns]"
      ]
     },
     "execution_count": 88,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# remove label is -1\n",
    "df = df[df['label']!=-1]\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>history_item_id</th>\n",
       "      <th>target_item_id</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>17</td>\n",
       "      <td>27</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>19</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>20</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>21</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>22</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98075</th>\n",
       "      <td>2268</td>\n",
       "      <td>2414</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98080</th>\n",
       "      <td>1308</td>\n",
       "      <td>2262</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98081</th>\n",
       "      <td>1435</td>\n",
       "      <td>2262</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98082</th>\n",
       "      <td>1176</td>\n",
       "      <td>2262</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98083</th>\n",
       "      <td>2117</td>\n",
       "      <td>2262</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>38833 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       history_item_id  target_item_id  label\n",
       "0                   17              27      1\n",
       "1                   19              27      2\n",
       "2                   20              27      2\n",
       "3                   21              27      2\n",
       "4                   22              27      2\n",
       "...                ...             ...    ...\n",
       "98075             2268            2414     10\n",
       "98080             1308            2262      6\n",
       "98081             1435            2262      2\n",
       "98082             1176            2262      6\n",
       "98083             2117            2262      0\n",
       "\n",
       "[38833 rows x 3 columns]"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# remove the same row\n",
    "df = df.drop_duplicates()\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# read df_lable_5 rows\n",
    "label = 8\n",
    "with open(f\"lable_{label}_item_pairs.txt\",\"w\") as outf:\n",
    "    for index, row in df[df[\"label\"]==label].iterrows():\n",
    "        # print(\"history_item_id:\",index2item[row[\"history_item_id\"]])\n",
    "        # print(\"target_item_id:\",index2item[row[\"target_item_id\"]])\n",
    "        # print(\"label:\",row[\"label\"])\n",
    "        outf.write(\"item1: \"+item2text[index2item[row[\"history_item_id\"]]]+\"\\t\"\"item2: \"+item2text[index2item[row[\"target_item_id\"]]]+\"\\n\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "relation 7:\n",
      "item1: Fellowes Thermal Binding Machine, Helios 30 (5219301) Binding Machines Fellowes item2: Wilson Jones View-Tab Transparent Dividers, 8-Tab Set, Square Multicolor, 5 Pack (5 sets of 8-Tab Dividers) (W55567) Binder Index Dividers Wilson Jones\n",
      "item1: Fellowes Powershred 59Cb Cross-Cut Shredder with Jam Blocker Technology Shredders Fellowes item2: Quartet 5001M EnduraGlide Chisel Tip Dry Erase Marker - 4 Pack, Assorted Colors Erasable Markers Quartet\n",
      "item1: Quartet Cork Bulletin Board, 2 x 3 Feet, Oak Finish Frame (MWDB2436M) Bulletin Boards nan item2: Quartet Cork Bulletin Board, 11 x 17 Inches, Black Frame (79279) Bulletin Boards nan\n",
      "item1: Swingline Customizable Fashion Stapler, 20 Sheets, Assorted Skins Designs (S7087880) Desktop Staplers Swingline item2: Quartet Dry-Erase Board, 11 x 17 Inches, Black Frame (21-580532Q-BK) Dry Erase Boards nan\n",
      "item1: Epson WorkForce WF-2530 Wireless All-in-One Color Inkjet Printer, Copier, Scanner, ADF, Fax. Prints from Tablet/Smartphone. AirPrint Compatible (C11CC37201) Inkjet Printers Epson item2: Quartet Magnetic Combination Board, 17 x 23 Inches, Dry-Erase and Cork, Black/Silver Frame (79370) Dry Erase Boards nan\n",
      "relation 8:\n",
      "item1: Quartet Magnetic Dry-Erase Calendar, 1-month, 11 x 14 Inches, White Frame (MHOP1114-W) Wall Calendars nan item2: Low-Odor Dry Erase Markers, Ultra-Fine Point, Assorted Colors, Set of 8 Erasable Markers Expo\n",
      "item1: Avery Sticky Notes, Perforated, 4 x 6 Inches, Citrus Colors, Ruled, 135 Sheets (22553) Self-Stick Notes Avery item2: Quartet Alphacolor Chalk Sticks, Assorted Colors, 8 Colors, 12/Pack (305003) Teaching Materials Quartet\n",
      "item1: Avery Steps Sticky Notes, Bold Colors, 150 Sheets (22592) Self-Stick Notes Avery item2: basyx by HON HVL251 Task Chair for Office or Computer Desk, Black Fabric Desk Chairs basyx by HON\n",
      "item1: Post-it Notes, Original Cube, 3 Inches x 3 Inches, Fruit Design, 3 Cubes Per Pack (C300-F-3PK) Self-Stick Notes nan item2: Epson WorkForce Pro WF-4630 Wireless and WiFi Direct All-in-One Color Inkjet Printer, Copier, Scanner, 2-Sided Auto Duplex, ADF, Fax. Prints from Tablet/Smartphone. AirPrint Compatible. (C11CD10201) Office Electronics Epson\n",
      "item1: Post-it Pop-up Notes Laptop Dispenser for 3 x 3-Inch Notes, Bright Pink, Green, and Gray, 3-Dispensers/Pack Self-Stick Note Pad Holders Post-It item2: Swingline Heavy Duty Staple Remover, Spring-loaded, Satin Finish (S7037201A) Staple Removers Swingline\n"
     ]
    }
   ],
   "source": [
    "for i in range(7,9):\n",
    "    df_pair = pd.read_csv(f\"lable_{i}_item_pairs.txt\",sep=\"\\t\",header=None)\n",
    "    print(f\"relation {i}:\")\n",
    "    df_pair = df_pair.sample(5)\n",
    "    for index, row in df_pair.iterrows():\n",
    "        print(row[0],row[1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>head</th>\n",
       "      <th>relation</th>\n",
       "      <th>tail</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>170</td>\n",
       "      <td>1</td>\n",
       "      <td>451</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>170</td>\n",
       "      <td>1</td>\n",
       "      <td>1886</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>170</td>\n",
       "      <td>1</td>\n",
       "      <td>2159</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>170</td>\n",
       "      <td>1</td>\n",
       "      <td>45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>170</td>\n",
       "      <td>1</td>\n",
       "      <td>1107</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60701</th>\n",
       "      <td>2403</td>\n",
       "      <td>4</td>\n",
       "      <td>2468</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60702</th>\n",
       "      <td>2395</td>\n",
       "      <td>4</td>\n",
       "      <td>2468</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60703</th>\n",
       "      <td>2398</td>\n",
       "      <td>4</td>\n",
       "      <td>2468</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60704</th>\n",
       "      <td>2399</td>\n",
       "      <td>4</td>\n",
       "      <td>2467</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60705</th>\n",
       "      <td>2417</td>\n",
       "      <td>4</td>\n",
       "      <td>2802</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>60706 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       head  relation  tail\n",
       "0       170         1   451\n",
       "1       170         1  1886\n",
       "2       170         1  2159\n",
       "3       170         1    45\n",
       "4       170         1  1107\n",
       "...     ...       ...   ...\n",
       "60701  2403         4  2468\n",
       "60702  2395         4  2468\n",
       "60703  2398         4  2468\n",
       "60704  2399         4  2467\n",
       "60705  2417         4  2802\n",
       "\n",
       "[60706 rows x 3 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_kg = pd.read_csv('relation_df.csv')\n",
    "df_kg"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>head</th>\n",
       "      <th>tail</th>\n",
       "      <th>relation</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>170</td>\n",
       "      <td>451</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>170</td>\n",
       "      <td>1886</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>170</td>\n",
       "      <td>2159</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>170</td>\n",
       "      <td>45</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>170</td>\n",
       "      <td>1107</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60701</th>\n",
       "      <td>2403</td>\n",
       "      <td>2468</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60702</th>\n",
       "      <td>2395</td>\n",
       "      <td>2468</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60703</th>\n",
       "      <td>2398</td>\n",
       "      <td>2468</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60704</th>\n",
       "      <td>2399</td>\n",
       "      <td>2467</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>60705</th>\n",
       "      <td>2417</td>\n",
       "      <td>2802</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>60706 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       head  tail  relation\n",
       "0       170   451         1\n",
       "1       170  1886         1\n",
       "2       170  2159         1\n",
       "3       170    45         1\n",
       "4       170  1107         1\n",
       "...     ...   ...       ...\n",
       "60701  2403  2468         4\n",
       "60702  2395  2468         4\n",
       "60703  2398  2468         4\n",
       "60704  2399  2467         4\n",
       "60705  2417  2802         4\n",
       "\n",
       "[60706 rows x 3 columns]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# change the order of the columns, head tail relation\n",
    "df_kg = df_kg[['head','tail','relation']]\n",
    "df_kg"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>head</th>\n",
       "      <th>tail</th>\n",
       "      <th>relation</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>17</td>\n",
       "      <td>27</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>19</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>20</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>21</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>22</td>\n",
       "      <td>27</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98075</th>\n",
       "      <td>2268</td>\n",
       "      <td>2414</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98080</th>\n",
       "      <td>1308</td>\n",
       "      <td>2262</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98081</th>\n",
       "      <td>1435</td>\n",
       "      <td>2262</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98082</th>\n",
       "      <td>1176</td>\n",
       "      <td>2262</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98083</th>\n",
       "      <td>2117</td>\n",
       "      <td>2262</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>38833 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       head  tail  relation\n",
       "0        17    27         1\n",
       "1        19    27         2\n",
       "2        20    27         2\n",
       "3        21    27         2\n",
       "4        22    27         2\n",
       "...     ...   ...       ...\n",
       "98075  2268  2414        10\n",
       "98080  1308  2262         6\n",
       "98081  1435  2262         2\n",
       "98082  1176  2262         6\n",
       "98083  2117  2262         0\n",
       "\n",
       "[38833 rows x 3 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# rename the columns of df to match the columns of df_kg\n",
    "df = df.rename(columns={'history_item_id':'head','target_item_id':'tail','label':'relation'})\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>head</th>\n",
       "      <th>tail</th>\n",
       "      <th>relation_x</th>\n",
       "      <th>relation_y</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>110</td>\n",
       "      <td>120</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>110</td>\n",
       "      <td>120</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>111</td>\n",
       "      <td>120</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>118</td>\n",
       "      <td>120</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>119</td>\n",
       "      <td>120</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2166</th>\n",
       "      <td>2413</td>\n",
       "      <td>2313</td>\n",
       "      <td>8</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2167</th>\n",
       "      <td>2253</td>\n",
       "      <td>2407</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2168</th>\n",
       "      <td>2150</td>\n",
       "      <td>2412</td>\n",
       "      <td>6</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2169</th>\n",
       "      <td>1538</td>\n",
       "      <td>2405</td>\n",
       "      <td>5</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2170</th>\n",
       "      <td>2337</td>\n",
       "      <td>2364</td>\n",
       "      <td>10</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2171 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      head  tail  relation_x  relation_y\n",
       "0      110   120           2           1\n",
       "1      110   120           2           2\n",
       "2      111   120           1           1\n",
       "3      118   120           2           1\n",
       "4      119   120           2           1\n",
       "...    ...   ...         ...         ...\n",
       "2166  2413  2313           8           2\n",
       "2167  2253  2407           1           2\n",
       "2168  2150  2412           6           2\n",
       "2169  1538  2405           5           1\n",
       "2170  2337  2364          10           2\n",
       "\n",
       "[2171 rows x 4 columns]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# get the same row of df and df_kg\n",
    "df_merge = pd.merge(df, df_kg, how='inner', on=['head','tail'])\n",
    "df_merge\n",
    "# df_merge[\"relation\"].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/ysh/miniconda3/envs/prompt/lib/python3.7/site-packages/ipykernel_launcher.py:1: UserWarning: Boolean Series key will be reindexed to match DataFrame index.\n",
      "  \"\"\"Entry point for launching an IPython kernel.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>head</th>\n",
       "      <th>tail</th>\n",
       "      <th>relation_x</th>\n",
       "      <th>relation_y</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>110</td>\n",
       "      <td>120</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>180</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>351</td>\n",
       "      <td>592</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>57</th>\n",
       "      <td>830</td>\n",
       "      <td>1452</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>66</th>\n",
       "      <td>1514</td>\n",
       "      <td>1314</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2081</th>\n",
       "      <td>397</td>\n",
       "      <td>1888</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2083</th>\n",
       "      <td>777</td>\n",
       "      <td>1888</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2103</th>\n",
       "      <td>659</td>\n",
       "      <td>2408</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2117</th>\n",
       "      <td>347</td>\n",
       "      <td>2398</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2123</th>\n",
       "      <td>69</td>\n",
       "      <td>483</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>98 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      head  tail  relation_x  relation_y\n",
       "1      110   120           2           2\n",
       "5        6   180           2           2\n",
       "19     351   592           2           2\n",
       "57     830  1452           2           2\n",
       "66    1514  1314           2           2\n",
       "...    ...   ...         ...         ...\n",
       "2081   397  1888           2           2\n",
       "2083   777  1888           2           2\n",
       "2103   659  2408           2           2\n",
       "2117   347  2398           2           2\n",
       "2123    69   483           2           2\n",
       "\n",
       "[98 rows x 4 columns]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_merge[df_merge[\"relation_x\"]==df_merge[\"relation_y\"]][df_merge[\"relation_x\"]==2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>head</th>\n",
       "      <th>tail</th>\n",
       "      <th>relation</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>110</td>\n",
       "      <td>120</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>111</td>\n",
       "      <td>120</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>6</td>\n",
       "      <td>180</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>430</td>\n",
       "      <td>448</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>351</td>\n",
       "      <td>592</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>540</th>\n",
       "      <td>69</td>\n",
       "      <td>483</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>541</th>\n",
       "      <td>1217</td>\n",
       "      <td>546</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>542</th>\n",
       "      <td>459</td>\n",
       "      <td>546</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>543</th>\n",
       "      <td>1341</td>\n",
       "      <td>2314</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>544</th>\n",
       "      <td>175</td>\n",
       "      <td>198</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>545 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     head  tail  relation\n",
       "0     110   120         2\n",
       "1     111   120         1\n",
       "2       6   180         2\n",
       "3     430   448         1\n",
       "4     351   592         2\n",
       "..    ...   ...       ...\n",
       "540    69   483         2\n",
       "541  1217   546         1\n",
       "542   459   546         1\n",
       "543  1341  2314         1\n",
       "544   175   198         1\n",
       "\n",
       "[545 rows x 3 columns]"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.merge(df, df_kg, how='inner', on=['head','tail','relation'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1    38071\n",
       "2    18345\n",
       "3     2351\n",
       "4     1939\n",
       "Name: relation, dtype: int64"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ralation_count = df_kg[\"relation\"].value_counts()\n",
    "ralation_count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "6     7620\n",
       "1     6010\n",
       "9     4733\n",
       "0     4050\n",
       "10    3672\n",
       "2     3662\n",
       "7     3295\n",
       "8     3210\n",
       "5     2581\n",
       "Name: label, dtype: int64"
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "label_count = df[\"label\"].value_counts()\n",
    "label_count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjAAAAGiCAYAAAD5t/y6AAAAOXRFWHRTb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lwY7taCjBgxwkpOTrYcDod1xhlnWIMHD7ZWr14d7rZ+UFu9jfqWW26xEhISLIfDYZ155pnWLbfcYn3yySfhbusIr732mnXeeedZTqfT6t27tzV//vxwt3RUq1atsiRZO3fuDHcrxxQIBKz77rvPSkpKsqKjo62zzjrLevDBB62GhoZwtxZkyZIl1llnnWU5HA7L4/FYPp/PqqurC2tPP/S7vLm52Xr44Yctt9ttOZ1Oa/DgwW36e+H7Iiyrjb2dIQAAwA/gGhgAAGAcAgwAADAOAQYAABiHAAMAAIxDgAEAAMYhwAAAAOMQYAAAgHEIMAAAwDgEGAAAYBwCDAAAMA4BBgAAGOf/AAPJs2Taecm/AAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# draw a bar figure of label_count\n",
    "import matplotlib.pyplot as plt\n",
    "x = list(label_count.index)+[3,4]\n",
    "y = list(label_count.values)+[0,0]\n",
    "# x,y\n",
    "plt.bar(x,y)\n",
    "# plt.bar(label_count.index,label_count)\n",
    "plt.xticks(x)\n",
    "# plt.bar(ralation_count.index,ralation_count)\n",
    "plt.savefig(dpi=300, fname='label_count.png')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "prompt",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.11"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
